package com.zhuandshao.Inheritance;

import com.zhuandshao.Inheritance.Manager;

public class Company {
    public static void main(String[] args) {
        Employee[] staff = new Employee[3];

        Manager mag = new Manager("manager", 9, 46);
        staff[0] = mag;

        staff[1] = new Employee("david", 43);
        staff[2] = new Employee("did", 43);

        /**
         * e可以引用Employee也可以引用Manager  称为多态，实际使用时会调用不同类的方法。
         */
        for (Employee e : staff) {
            System.out.println(e.getName());
        }

        System.out.println(mag.getMoney());
        mag.setMoney(45);

        System.out.println(mag.getAge());
        System.out.println(mag.getName());
        System.out.println(mag.getMoney());
    }

}/*
  * @Author: qianmingtian
  * 
  * @Date: 2020-05-25 19:39:16
  * 
  * @LastEditors: qianmingtian
  * 
  * @LastEditTime: 2020-05-25 19:39:16
  * 
  * @FilePath:
  * \qianmingtian.github.io\code\java\com\zhuandshao\Inheritance\Company.java
  */
